﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SimpleRest.Core
{
    /// <summary>
    /// Delegate used within IHttpMessageHandler for driving HttpResponse's.
    /// </summary>
    /// <param name="response"></param>
    public delegate void ExecuteResponseHandler(IHttpResponseMessage response);

    /// <summary>
    /// Interface that should be implemented for any HttpMessageHandler's that a developer wants to create and add to their REST pipeline.
    /// The input parameter gives visibility into the incoming request and the return delegate gives visibility into the response.  This
    /// allows the developer to tap into the actual request and the response at the appropriate time during the pipeline lifecycle.
    /// </summary>
    public interface IHttpMessageHandler
    {
        /// <summary>
        /// Execute the logic for this message handler.  Anything dealing with the return type will be executed at the end of the pipeline and
        /// any logic not included in the return type will be executed at the front of the pipeline.
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        ExecuteResponseHandler Execute(MessageHandlerContext request);
    }
}
